<?php
	include_once('header.php');
	if(isset($_GET['id'])){
		require('conn.php');
		$qfid = $_GET['id']; 
		$deadlineQuery = mysql_query("select name, deadline from questionForm where qfid = $qfid");
		if($deadline = mysql_fetch_assoc($deadlineQuery)){
			echo "<div style='text-align:center;font-size:30px'>".$deadline['name']."</div><br>";
		}
		$questionArray = mysql_query("select qid, question from question where qfid = $qfid");
		$i = 1;		
		while($question = mysql_fetch_assoc($questionArray)){
			
			echo "<div>Q$i. <a href='statistic.php?id=".$question['qid']."&qfid=".$qfid."&page=1'>".$question['question']."</a></div>";
			$i++;
		}
		if($deadline['deadline'] != 0){
			echo "<br><br>";
			echo "Deadline of this form: ".date('m/d/Y',$deadline['deadline'])."<br><br>";
		}
		echo "Answer: <a href='http://localhost/Vote4U/answer.php?id=$qfid'>http://localhost/Vote4U/answer.php?id=$qfid</a>";
		mysql_close($connect);
	}
	else{
		echo "Invalid access!";
	}
?>